package com.example.jetpacktest.lifecycle

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.example.jetpacktest.R
import kotlinx.android.synthetic.main.activity_life_cycle_example.*
import org.jetbrains.anko.startActivity

class LifeCycleExampleActivity : AppCompatActivity(), View.OnClickListener {
    override fun onClick(v: View?) {
        when (v?.id) {
            R.id.life_cycle_activity -> {
                startActivity<LifeCycleActivity>()
            }
            R.id.life_cycle_fragment -> {
                startActivity<LifeCycleFragmentActivity>()

            }
            R.id.life_cycle_service -> {
                startActivity<LifecycleServiceActivity>()

            }
        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_life_cycle_example)
        life_cycle_activity?.setOnClickListener(this)
        life_cycle_fragment?.setOnClickListener(this)
        life_cycle_service?.setOnClickListener(this)

    }
}
